﻿using System;

namespace HEFramework
{
    public interface IDeserialize
    {
    }

    public interface IDeserializeSystem : ISystemType
    {
        void Run(Entity _o);
    }


    /// <summary>
    ///
    /// 反序列化后执行的System
    /// 
    /// ----------------------------------------
    /// 作者 hep
    /// 创建时间：2023-12-12 10:16:34
    /// ----------------------------------------
    /// </summary>
    [EntitySystem]
    public abstract class DeserializeSystem<T> : IDeserializeSystem where T : Entity, IDeserialize
    {
        Type ISystemType.Type()
        {
            return typeof(T);
        }

        Type ISystemType.SystemType()
        {
            return typeof(IDeserializeSystem);
        }

        int ISystemType.GetInstanceQueueIndex()
        {
            return InstanceQueueIndex.None;
        }

        void IDeserializeSystem.Run(Entity _o)
        {
            this.Deserialize((T)_o);
        }

        protected abstract void Deserialize(T _self);
    }
}